home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Modules / BackSpaceModules / Source / CreepyFace / CFWireFrame.h next >
Text File  |  1994-03-23  |  3KB  |  92 lines

  1. #import <appkit/appkit.h>
  2.  
  3. #define WIREFRAME_COORDLIMIT 1024
  4.  
  5.  
  6. // this code is copyright Darcy Brockbank, 1993
  7. //
  8. // You may freely reuse and distribute this code in any way shape or
  9. // form, provided that this notice stays intact.
  10. //
  11. // darcy@hasc.ca, samurai@cs.mcgill.ca
  12. //
  13. // StefView was implemented out of WorldSpaceView and retains some of the
  14. // movement properties...
  15. //
  16. // The code for WorldSpaceView was written by Sam Streeper at CreepyFace, I think,
  17. // and there were two other contributors, but I can't find their names in the
  18. // source for it.
  19. //
  20. // CreepyFaceView shows a simple (ha!) spinning CreepyFace logo, in full 3D. The 3D code
  21. // came from an app I wrote a long time ago called "CFWireFrame", and so the code
  22. // is pretty scary. As well, this thing is only a quick hack, though a nice one.
  23. //
  24. // This thing has room for improvement, and if you do so, send me a copy!
  25. //
  26. // - darcy
  27.  
  28. typedef enum {
  29.     x=0,y=1,z=2 
  30. } Axis;
  31.  
  32. typedef enum {
  33.     negative=0,positive=1,nomove=2
  34. } Direction;
  35.  
  36. typedef struct _Origin {
  37.     float x,y,z;
  38. } Origin;
  39.  
  40. @interface CFWireFrame:Object
  41. {
  42.     int numberOfCoords;
  43.     int numberOfTags;
  44.     int coordsInATag;
  45.     int numberOfMyPS;
  46.     int numberOfTagPS;
  47.     float myCoords[1024];
  48.     float myTags[1024];
  49.     char myPSCommands[1024];
  50.     char myTagPSCommands[1024];
  51.      float output[WIREFRAME_COORDLIMIT];
  52.      float bbox[4];
  53.      int dimension;
  54.     
  55.     struct _Origin myCentre;
  56.     struct anRGBColour {
  57.         float red,blue,green;
  58.     } myTagColour,myFrameColour;
  59.     float myLineWidth;
  60.     double psint;
  61.     double nsint;
  62.     double cost;
  63.     id myTable;
  64. }
  65.  
  66. - addPoint:(float)x :(float)y :(float)z;
  67. - addMyPS:(char)command;
  68. - free; 
  69. - (int) getNumberOfMyPS;
  70. - (int)getNumberOfPoints;
  71. - init;
  72. - makeCFWireFrame:(const char *)thisFrame;
  73. - readBinaryCodeFrom: (char *) thisFile;
  74. - moveTo:(float )x:(float)y:(float)z;
  75. - getTagColour:(float *) r :(float *)g :(float *)b;
  76. - getFrameColour:(float *)r :(float *)g :(float *)b;
  77. - getCentre:(float*) x:(float *)y :(float *)z;
  78. - setCentre:(float) x :(float)y :(float)z;
  79. - setFrameColour:(float) r :(float)g :(float)b;
  80. - setTagColour:(float) r :(float)g :(float)b;
  81. - setNumberOfTags:(int)count;
  82. - setCoordsInATag:(int)count;
  83. - setNumberOfTagPS:(int)count;
  84. - setNumberOfCoords:(int) count;
  85. - setNumberOfMyPS:(int) count;
  86. - setBoundingBox:(float *)thisBox;
  87. - rotate: (Direction) direction aroundAxis:(Axis) thisAxis atOrigin:(Origin) thisOrigin;
  88. - translate: (Direction) direction alongAxis: (Axis) thisAxis atRate:(float)rate; 
  89. - drawYourself:(float)zoom centeredOn:(float)X :(float)Y;
  90.  
  91. @end
  92.